001 /* 002 * Copyright 2006 Stephen J. McConnell. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 013 * implied. 014 * 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package net.dpml.lang; 020 021 import java.net.URI; 022 023 /** 024 * Part info description. 025 * 026 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a> 027 * @version 1.0.1 028 */ 029 public final class Info extends AbstractDirective 030 { 031 private final String m_title; 032 private final String m_description; 033 private final URI m_uri; 034 035 /** 036 * Creation of a new part info descriptor. 037 * @param uri the part uri 038 * @param title the title of the part 039 * @param description the part description 040 */ 041 public Info( URI uri, String title, String description ) 042 { 043 m_uri = uri; 044 m_title = title; 045 m_description = description; 046 } 047 048 /** 049 * Get the part uri. 050 * 051 * @return the uri 052 */ 053 public URI getURI() 054 { 055 return m_uri; 056 } 057 058 /** 059 * Get the part title. 060 * 061 * @return the title 062 */ 063 public String getTitle() 064 { 065 return m_title; 066 } 067 068 /** 069 * Get the part description. 070 * 071 * @return the description 072 */ 073 public String getDescription() 074 { 075 return m_description; 076 } 077 078 /** 079 * Test if this instance is equal to the supplied instance. 080 * @param other the other instance 081 * @return the equality status 082 */ 083 public boolean equals( Object other ) 084 { 085 if( !super.equals( other ) ) 086 { 087 return false; 088 } 089 else if( other instanceof Info ) 090 { 091 Info info = (Info) other; 092 if( !equals( m_title, info.m_title ) ) 093 { 094 return false; 095 } 096 else 097 { 098 return equals( m_description, info.m_description ); 099 } 100 } 101 else 102 { 103 return false; 104 } 105 } 106 107 /** 108 * Get the hashcode for this instance. 109 * @return the hash value 110 */ 111 public int hashCode() 112 { 113 int hash = super.hashCode(); 114 hash ^= hashValue( m_title ); 115 hash ^= hashValue( m_description ); 116 return hash; 117 } 118 }